package com.jettech.oa.domain;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * 流程动态定义表单
 * @author Administrator
 *
 */
@Entity
@Table(name="jettech_work_flow_form")
public class WorkFlowForm {
	private Long id;//主键
	private WorkFlow workFlow;//所属流程
	private List<FormProperty> formProperties;
	private String name;//表单的属性名称
	private String label;//表单的标签
	private String type;//表单的类型,例如:字符串,整形,日期,Long ,Float,文件等
	private String inputType;//表单的输入形式,例如:下拉框,多选框,输入框等
	
	public WorkFlowForm(){
		
	}
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="work_flow_form_id")
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="work_flow_id")
	public WorkFlow getWorkFlow() {
		return workFlow;
	}
	public void setWorkFlow(WorkFlow workFlow) {
		this.workFlow = workFlow;
	}
	@OneToMany(fetch=FetchType.LAZY,mappedBy="workFlowForm")
	public List<FormProperty> getFormProperties() {
		return formProperties;
	}
	public void setFormProperties(List<FormProperty> formProperties) {
		this.formProperties = formProperties;
	}
	@Column(name="form_name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name="form_label")
	public String getLabel() {
		return label;
	}
	public void setLabel(String label) {
		this.label = label;
	}
	@Column(name="form_type",length=32)
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	@Column(name="input_type",length=32)
	public String getInputType() {
		return inputType;
	}
	public void setInputType(String inputType) {
		this.inputType = inputType;
	}
	public boolean equals(Object other){
		return EqualsBuilder.reflectionEquals(this, other);
	}
	public int hashCode(){
		return HashCodeBuilder.reflectionHashCode(this);
	}
	public String toString(){
		return ToStringBuilder.reflectionToString(this);
	}
}
